package cc.forgemod.customicon.common;

import org.apache.logging.log4j.Logger;

import cc.forgemod.customicon.common.command.ServerCommand;
import cc.forgemod.customicon.common.items.CIItem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;

@Mod(modid = CustomIcon.MODID, name = CustomIcon.MODNAME, version = CustomIcon.VERSION)
public class CustomIcon extends ACustomIcon {

    public static Logger log;

    @SidedProxy(clientSide = "cc.forgemod.customicon.client.ClientProxy", serverSide = "cc.forgemod.customicon.server.ServerProxy")
    public static IProxy mProxy;
    @Mod.Instance(CustomIcon.MODID)
    public static CustomIcon mInstance;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent pEvent) {
        super.preInit(pEvent.getModConfigurationDirectory(), pEvent.getModLog());

        ForgeRegistries.ITEMS.register(ConfigItems.mCItem = new CIItem().setRegistryName(CustomIcon.MODID, "ciitem")
                .setTranslationKey("ciitem").setCreativeTab(CreativeTabs.MATERIALS));

        CustomIcon.mProxy.preInit(pEvent);
    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent pEvent) {
        super.init();
        CustomIcon.mProxy.init(pEvent);
    }

    @Mod.EventHandler
    public void onServerStart(FMLServerStartingEvent pEvent) {
        super.onServerStart(pEvent.getServer());
        pEvent.registerServerCommand(new ServerCommand());
    }

}
